﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Administrator_ManagerClip : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string pathfile = Server.MapPath("~/App_Data/VideoClips.xml");
            InsertXML(pathfile, txtvideopath.Text, txtvideotitle.Text);
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }
    private bool InsertXML(string path, string fileName,string title)
    {
        try
        {
            DataRow dr;
            DataSet dt = new DataSet();
            dt.ReadXml(path);
            dr = dt.Tables[0].NewRow();
            dr["title"] = title;
            dr["linkyt"] = fileName;
            dt.Tables[0].Rows.Add(dr);
            dt.WriteXml(path, XmlWriteMode.WriteSchema);
        }
        catch
        {
        }
        return true;
    }
}